<!DOCTYPE html>
<!-- saved from url=(0013)about:internet -->
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
    <title>新增标签</title>
    <th:block th:replace="admin/_fragments :: somehead"></th:block>
</head>

<body>
    
    <nav th:replace="admin/_fragments :: backnav(3)"></nav>

    <div class="ui attached pointing menu">
        <div class="ui container">
            <a th:href="@{/admin/tags/input}" class="active orange item">添加标签</a>
            <a th:href="@{/admin/tags}" class="item">标签列表</a>
        </div>

    </div>

    <div class="fluid container m-padded-tb-large">
        <div class="ui container">
            <form method="POST" th:object="${tag}" th:action="*{id}==null ? @{/admin/tags} : @{/admin/tags/{id}(id=*{id})}" class="ui form">
            		<input type="hidden" name="id" th:value="*{id}">
                    <div class="required field">
                        <div class="ui left labeled input">
                            <label class="ui teal basic label">标签名称</label>
                            <input type="text" name="name" placeholder="标签名称" th:value="*{name}">
                        </div>
                    </div>
                  
                    <div class="ui negative message" th:if="${#fields.hasErrors('name')}">
                    	<i class="close icon"></i>
                    	<div class="header">验证失败</div>
                    	<p th:errors="*{name}">提交信息不符合规则</p>
                    </div>
                   
                    
                    <div class="ui container m-padded-tb-default">
                        <button type="button" class="ui button" onclick="window.history.go(-1)">返回</button>
                        <button type="submit" class="ui teal submit button">提交</button>
                    </div>
            </form>
        </div>
    </div>
    
    <br><br><br>
    <br><br><br>

    <footer th:replace="admin/_fragments :: footer" ></footer>

    <script>
        $('.m-menu-toggle').click(function() {
            $('.m-item').toggleClass('m-mobile-hide');
        });

        $('.ui.dropdown').dropdown({
            on: 'hover'
        });

        $('.ui.form').form({
            fields: {
                title: {
                    identifier: 'name',
                    rules: [{
                        type: 'empty',
                        prompt: '请输入分类名称'
                    }]
                }
            }
        });
        
        $(' .message .close').on('click',function(){
        	$(this).closest('.message').transition('fade');
        });
    </script>
</body>

</html>